package com.bosssoft.permission.centre.api;



import com.bosssoft.permission.centre.pojo.dto.pcp.ResourceDTO;
import com.bosssoft.permission.centre.pojo.query.ResourceQuery;
import com.bosssoft.permission.centre.pojo.vo.ResourceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.web.bind.annotation.CrossOrigin;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.ResponseBody;

@CrossOrigin

@RequestMapping(value = "/permission/centre/resource")
public interface ResourceApi {

    /**
     * @param: 模糊查询
     * 查询条件
     * 1. name
     * 2. parent ID
     * @return:
     * @see
     * @since
     */

    @ApiOperation(tags="资源模块查询",value="")
    @GetMapping(value = "")
    @ResponseBody
    List<ResourceVO> commonQuery(ResourceQuery resourceQuery );


    @ApiOperation(tags="资源树查询",value="")
    @GetMapping(value = "/getALL")
    @ResponseBody
    List<ResourceVO> query(ResourceQuery resourceQuery );

    /**
     * @param:  添加
     * @return:
     * @see
     * @since
     */

    @ApiOperation(tags = "添加资源" ,value = "")
    @PostMapping(value = "")
    @ResponseBody
    Boolean add (@RequestBody @Valid ResourceDTO resourceDTO );


    /**
     * @param: id
     * @return: 查询的DTO
     * @see： 查询子系统通过ID
     * @since
     */
    @GetMapping(value = "{id}")
    @ResponseBody
    ResourceVO queryResourceById(@PathVariable("id") Long id);

    /**
     * @param: parent id
     * @return: 查询的DTO
     * @see： 查询子系统通过ID
     * @since
     */
    @GetMapping(value = "findParent/{parentId}")
    @ResponseBody
    ResourceVO queryResourceByParentId(@PathVariable("parentId") Long id);



    @GetMapping(value = "/Menu")
    @ResponseBody
    List<ResourceVO> queryResourceByMenu();

    /**
     * @param:
     * @return:
     * @see
     * @since
     */
    @ApiOperation(tags="删除资源",value="")
    @DeleteMapping(value="")
    @ResponseBody
    Boolean remove(@ApiParam(value = "当前行id", required = true) @RequestParam("id") Long id
//            ,@ApiParam(value = "当前行版本", required = true) @RequestParam("version") Long version
    );


    /**
     * @param: 围栏通知DTO数组
     * @return: 成功则true
     * @see
     * @since
     */
    @ApiOperation(tags="批量删除围栏通知",value="")
    @DeleteMapping(value="/batch")
    @ResponseBody
    Boolean batchDelete(@RequestBody @Valid ResourceDTO[] resourceDTOS);



    /**
     * @param:对资源进行修改
     * @return:成功 true
     * @see
     * @since
     */
    @ApiOperation(tags="修改资源",value="")
    @PutMapping(value = "")
    @ResponseBody
    Boolean modify(@RequestBody @Valid ResourceDTO resourceDTO);
//
    /**
     * @param: 被拷贝的记录id
     * @return: 拷贝后的完整对象
     * @see
     * @since
     *
     */
    @ApiOperation(tags="拷贝资源",value="/copy")
    @PostMapping(value = "/copy")
    @ResponseBody
    ResourceDTO copy(Long id);

}
